package com.agrm.api.client;

import com.agrm.model.common.dtos.ResponseResult;
import com.agrm.model.order.dto.OrderSubmit;
import com.agrm.model.order.pojo.Order;
import com.agrm.model.order.pojo.OrderItem;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("order-service")
public interface OrderClient {
    /**
     * 根据订单ID获取订单信息的接口
     *
     * @param id 订单ID，通过路径变量传递
     * @return 返回一个ResponseResult对象，其中包含Order类型的数据
     */
    @GetMapping("/api/v1/order/get")
    ResponseResult<Order> getOrderById(@RequestParam("id") Integer id);

    @PostMapping("/api/v1/order/submit")
    ResponseResult<Boolean> save(@RequestBody OrderSubmit orderSubmit);

    @PutMapping("/api/v1/order/update")
    ResponseResult<Boolean> update(@RequestBody Order order);

    @GetMapping("/api/v1/order/getItemById")
    ResponseResult<List<OrderItem>> findByItemId(@RequestParam("id") Integer id);

    @DeleteMapping("/api/v1/order/deleteItem")
    ResponseResult<Boolean> deleteByIds(@RequestBody List<Integer> ids);

    @GetMapping("/api/v1/order/getItemByNo")
    ResponseResult<Order> getOrderByNo(@RequestParam("no")String no);
}
